#!/bin/bash
#所查找的目录
FINDDIR=
DATE=$(date "+%Y-%m-%d_%H-%M-%S")
DEV_TARGETS=
#修改天数
MDAYS=1
if [ $# != 1 ] ; then 
    echo "USAGE: $0 查找修改文件的天数范围,没有提供参数,默认在根目录收集一天以内修改的文件"
    FINDDIR+=/root/UKing_OTTSystem/SwissKnifeTool_Library/
    FINDDIR+=" "
    FINDDIR+=/root/AcademicsStudy/
    FINDDIR+=" "
    FINDDIR+=/root/TVT/
    FINDDIR+=" "
    MDAYS=1
else
    FINDDIR+=`echo $PWD`
    MDAYS=$1
    
fi



for i in $FINDDIR ;
do
      for((j=0;j<$MDAYS;j++));
      do  
	      echo "收集 目录 $i 下 $(expr $j \* 24)h-$(expr $(expr $j + 1) \* 24)h修改的文件"
	      DEV_TARGETS+=$(find $i -type f   -not -name "core.[0-9]*" -mtime $j)
      done
done


TARGETFILENAME=`basename $0`_${DATE}.tar.gz
if  [  -f   ${TARGETFILENAME} ];then
    rm  -rf ${TARGETFILENAME}
fi
echo "目标文件:$TARGETFILENAME"    
tar   -zcvf $TARGETFILENAME  $DEV_TARGETS

